<template>
  <div class="buttonDe">
    <!--<el-button type="text" size="mini" @click="dialogFormVisibleAdd = true" >管理 </el-button>-->
    <i class="iconfont icon-setting1" @click="dialogFormVisibleAdd = true"></i>
    <el-dialog class="dialog500" :close-on-click-modal="false" :append-to-body="true"  title="企业备案信息" :visible.sync="dialogFormVisibleAdd" @opened="$store.commit('dialogTop')" >
      <div style="padding: 4px 0 5px 0;">
        <el-table
          ref="multipleTable"
          :data="rows"
          stripe
          tooltip-effect="dark"
          style="width: 100%;"
        >
          <el-table-column
            label="信息类别"
            prop="a"
            min-width="260"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column
            label="操作"
          >
            <template slot-scope="scope">
              <el-button
                v-if="$store.state.btnMenuIds.indexOf(53)>-1"
                @click="upload(scope.row.id,1)"
                type="text"
                size="mini"
              >备案
              </el-button>
              <el-button
                v-if="$store.state.btnMenuIds.indexOf(196)>-1"
                @click="upload(scope.row.id,2)"
                type="text"
                size="mini"
              >查看
              </el-button>
            </template>
          </el-table-column>
         <!-- <el-table-column
            label="下载管理"
          >
            <template slot-scope="scope">
              <i @click="upload(scope.row.id,2)" class="iconfont icon-chakan" ></i>

            </template>
          </el-table-column>-->
        </el-table>
      </div>
    </el-dialog>
    <auploadDialog ref="auploadDialog" :enterpriseNo="enterpriseNo" :fileType="fileType"></auploadDialog>
    <downloadList ref="downloadList" :fileType="fileType" :enterpriseNo="enterpriseNo"></downloadList>
     </div>
</template>

<script>
  import auploadDialog from "./uploadDialog.vue"
  import downloadList from "./downloadList.vue"
  export default {
    props:["enterpriseNo"],
    data () {
      var phoneCheck = (rule, value, callback) => {
        var phnum = /^1[3456789]{1}\d{9}$/
        if (value === '') {
          callback(new Error('联系电话不能为空'));
        }else if(!phnum.exec(Number(value))){
          callback(new Error('请正确输入手机号！'));
        } else {
          callback();
        }
      };

      return {
        rows: [
          {a:'深圳市互联网租赁自行车企业备案表',id:0},
          {a:'企业法人营业执照',id:1},
          {a:'经营和办公场所的权属证明或者租赁合同',id:2},
          {a:'经营管理制度',id:3},
          {a:'押金、预付资金专用账户证明及押金存管协议',id:4},
          {a:'人员证明资料',id:5},
        ],
        fileType:"",
        ruleFormAdd: {},
        dialogFormVisibleAdd: false,
        rulesAdd: {
          mobile: [
            {validator: phoneCheck, }
          ],
        }
      }
    },
    created(){

    },
    components: {auploadDialog,downloadList},
    methods: {
      upload(id,key){
        this.fileType=id
        if(key==1){
          this.$refs.auploadDialog.dialogFormVisibleAdd=true
        }else {
          this.$refs.downloadList.dialogDownload=true
        }
      },
      //提交回调
      handleDiaSureAdd(){
        this.axios.post(process.env.API_HOST + '/systemUser/insert', {...this.ruleFormAdd})
          .then(response => {
            let result=response.data
            if (result.code == 200) {
              this.$message({
                type: 'success',
                message: '新增成功!'
              });
              this.dialogFormVisibleAdd = false
              this.$emit('getListInfo')
              this.resetForm('ruleFormAdd')
            }

          })
          .catch(error => {
            console.log(error);
          });
      },
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
//            this.handleDiaSureAdd()
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }

</script>

<style lang="stylus" rel="stylesheet/stylus" >
  @import "../../../common/stylus/mixin.styl"
  .buttonDe
    display inline-block
    margin-left 10px
  .dialog500 .el-dialog
    width 500px !important;

</style>
